package cn.hallele.leinsteining.mc.infrastructure.metadata.io;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 查询类接口的dto基类，可通过继承拓展
 *
 * @author anle5
 * @since 2024/4/13 22:46
 */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "查询类接口的dto基类")
public class Query implements Serializable {
    @Serial
    private static final long serialVersionUID = 846247619446765441L;

    /**
     * 页码
     */
    @Min(1)
    @Schema(description = "页码")
    private Integer pageNo = 1;

    /**
     * 每页数量
     */
    @Min(1)
    @Schema(description = "每页数量,默认为10")
    private Integer pageSize = 10;

    /**
     * 关键字
     */
    @Schema(description = "关键字")
    private String keywords;

    /**
     * 起始时间
     */
    @Schema(description = "起始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @Schema(description = "结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;
}
